from launch import LaunchDescription
from launch_ros.actions import Node
#节点重名
# def generate_launch_description():
#     return LaunchDescription([
#         Node(package="turtlesim",executable="turtlesim_node",name="turtle1"),
#         Node(package="turtlesim",executable="turtlesim_node",namespace="t1"),
#         Node(package="turtlesim",executable="turtlesim_node",namespace="t1",name="t1")
#     ]) 
#话题重名
def generate_launch_description():
    t1=Node(package="turtlesim",executable="turtlesim_node",name="turtle1") #name用于修改节点名称
    t2=Node(package="turtlesim",executable="turtlesim_node",namespace="t1") #namespace可以作用于话题和节点
    t3=Node(package="turtlesim",executable="turtlesim_node",
             remappings=[("/turtle1/cmd_vel","cmd_vel")])    #话题重映射,一个节点可能有多个话题，所以要两个参数
       
    return LaunchDescription([t1,t2,t3 ])
         
